package com.itheima.utils.thread;


import com.itheima.model.user.pojos.User;


public class MpThreadLocalUtil {
    private final static ThreadLocal<User> MP_USER_THREAD_LOCAL = new ThreadLocal<>();
    //存入线程中
    public static void setUser(User user) {MP_USER_THREAD_LOCAL.set(user);
    }
    //从线程中获取
    public static User getUser() {
        return MP_USER_THREAD_LOCAL.get();
    }
    //清除线程数据
    public static void clear(){
        MP_USER_THREAD_LOCAL.remove();
    }
}
